package com.rongcheng.frc.androidlib.utils;

import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;

import java.io.File;

/**
 * Created by FengRongCheng on 2016/6/19 15:14.
 * powered by yanxiu.com
 * 基于Glide封装的关于图片加载显示的类
 */
public class YXPictureManager {

    public static YXPictureManager getInstance() {
        return YXPictureManagerHodler.instance;
    }

    private static class YXPictureManagerHodler {
        private final static YXPictureManager instance = new YXPictureManager();
    }

    public void showPic(Context context, String url, ImageView view, int id) {
        Glide.with(context).load(url).placeholder(id).into(view);

    }

    public void showPic(Context context, String url, ImageView view, Drawable drawable) {
        Glide.with(context).load(url).placeholder(drawable).into(view);

    }

    public void showPic(Context context, String url, ImageView view) {
        Glide.with(context).load(url).into(view);

    }

    public void showPic(Context context, byte[] model, ImageView view) {
        Glide.with(context).load(model).into(view);

    }

    public void showPic(Context context, Uri uri, ImageView view) {
        Glide.with(context).load(uri).into(view);

    }

    public void showPic(Context context, File file, ImageView view) {
        Glide.with(context).load(file).into(view);

    }
}
